//返回对象
function getPolicyInfo(){
    if(confirm("确定要执行吗？")){
        var paras=new Map();
        paras.put("para1",$("#para1").val());
        paras.put("para2",$("#para2").val());
        paras.put("para3",$("#para3").val());
        paras.put("para4",$("#para4").val());
        paras.put("para5",$("#para5").val());
        paras.put("sel1",$("#sel1").val());
        var requrl=top.tophead.ctxpath+"/sample/AjaxJsonCtrl!getPolicyInfo.do";
        execAjax(requrl,paras.toObj(),function(result){
            $("#msgInfo").text(result.policyId+" , "+result.carVo.carLicenseNo+" , "+result.spInfoVo.length+" , "+result.insureVo.length)
        });
    }
}

//对象作为参数
function policyInfo(){
    var policyInfo=new Map();
    policyInfo.put("policyId",$("#para1").val());
    policyInfo.put("policyNo",$("#para2").val());
    policyInfo.put("startDate",$("#para3").val());
    policyInfo.put("policyType",$("#para4").val());
    var carVo=new Map();
    carVo.put("carId","carID编码");
    carVo.put("carLicenseNo","car车牌");
    policyInfo.put("carVo",carVo.toObj());
    var paras=policyInfo.toObj();
    var requrl=top.tophead.ctxpath+"/sample/AjaxJsonCtrl!policyInfo.do";
    execAjax(requrl,paras,function(result){
        $("#msgInfo").text(result.policyId+" , "+result.carVo.carLicenseNo+" , "+result.spInfoVo.length+" , "+result.insureVo.length)
    });
}
//对象作为参数
function putPolicyInfo(){
    var spInfoVo=new Map();
    spInfoVo.put("para1",$("#para1").val());
    spInfoVo.put("para2",$("#para2").val());
    spInfoVo.put("para3",$("#para3").val());
    spInfoVo.put("para4",$("#para4").val());
    var paras=spInfoVo.toObj();
    var requrl=top.tophead.ctxpath+"/sample/AjaxJsonCtrl!putPolicyInfo.do";
    execAjax(requrl,paras,function(result){
        $("#msgInfo").text(result.policyId+" , "+result.carVo.carLicenseNo+" , "+result.spInfoVo.length+" , "+result.insureVo.length)
    });
}
//List对象作为参数
function listPara(){
    var strs=new List();
//    var spInfoVo1=new Map();
//    spInfoVo1.put("seqId",document.getElementById("para1").value);
//    spInfoVo1.put("spNo",document.getElementById("para2").value);
//    spInfoVo1.put("spName",document.getElementById("para3").value);
//    spInfoVo1.put("spContent",document.getElementById("para4").value);
//    strs.add(spInfoVo1.toObj());
//    var spInfoVo2=new Map();
//    spInfoVo2.put("seqId",document.getElementById("para1").value);
//    spInfoVo2.put("spNo",document.getElementById("para2").value);
//    spInfoVo2.put("spName",document.getElementById("para3").value);
//    spInfoVo2.put("spContent",document.getElementById("para4").value);
//    strs.add(spInfoVo2.toObj());
    alert($("#para1").val())
    strs.add("Para1");
    strs.add("Para2");
//    var paras=strs.toObj();
//    alert(paras);
    $.ajax({
        type:"post",
//        contentType:'application/json;charset=UTF-8',
        dataType:"json",
        url:top.tophead.ctxpath+"/sample/AjaxJsonCtrl!listPara.do",
        data:strs,
        success:function(result){
            alert(result);
        }});
}
// ajax 提交form
function ajaxForm(){
//    $('#myform').action=top.tophead.ctxpath+"/sample/AjaxJsonCtrl!ajaxForm.do";
    myform.action=top.tophead.ctxpath+"/sample/AjaxJsonCtrl!ajaxForm.do";
//    $('#myform').ajaxForm(function(data){
//        alert(data);//弹出ajax请求后的回调结果
//    });
    $('#myform').ajaxSubmit(function(data){
        alert(data.seqId);
//        return false;
    });
}
